//
//  DiaryTableViewCell.m
//  土巴兔
//
//  Created by 千锋 on 15/12/30.
//  Copyright (c) 2015年 IOS1503薛凯. All rights reserved.
//

#import "DiaryTableViewCell.h"
#import "Default.h"
@implementation DiaryTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}
- (void)createUI{
    _titleLabel=[[UILabel alloc] init];
    _titleLabel.frame=CGRectMake(7, 10, DEVICEWIDTH-20, 20);
    _titleLabel.font=[UIFont systemFontOfSize:15];
    _titleLabel.textAlignment=NSTextAlignmentLeft;
    [self.contentView addSubview:_titleLabel];
    
    _context=[[UILabel alloc] init];
    _context.frame=CGRectMake(10, 30, DEVICEWIDTH-20, 50);
    _context.font=[UIFont systemFontOfSize:12];
    _context.numberOfLines=0;
    _context.alpha=0.8;
    [self.contentView addSubview:_context];
    
    _name=[[UILabel alloc] init];
    _name.frame=CGRectMake(10, 80, 60, 15);
    _name.font=[UIFont systemFontOfSize:12];
    _name.alpha=0.8;
    [self.contentView addSubview:_name];
    
    _time=[[UILabel alloc] init];
    _time.font=[UIFont systemFontOfSize:12];
    _time.alpha=0.8;
    _time.frame=CGRectMake(DEVICEWIDTH-70, 80, 60, 15);
    [self.contentView addSubview:_time];
}
- (void)relayoutWithModel:(MineModel*)model{
    if (model.title!=nil) {
         _titleLabel.text=model.title;
    }
    if (model.content!=nil) {
        _context.text=model.content;
    }
    if (model.name!=nil) {
        _name.text=model.name;
    }
    if (model.time!=0) {
        _time.text=[NSString stringWithFormat:@"%d"];
    }
    
}

@end
